package cn.bigcontainer.alt.cms.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.bigcontainer.alt.cms.dto.CmsNeirongDto;
import cn.bigcontainer.alt.cms.mapper.CmsNeirongMapper;
import cn.bigcontainer.alt.cms.po.CmsNeirong;
import cn.bigcontainer.alt.cms.service.CmsNeirongService;
import cn.bigcontainer.alt.common.util.WoKit;

/**
 * 内容的Service接口实现类.
 *
 * @author jiaod
 * @date 2020-05-13
 */
@Service
@Transactional
public class CmsNeirongServiceImpl implements CmsNeirongService {

	@Resource
	private CmsNeirongMapper cmsNeirongMapper;

	@Override
	public List<CmsNeirongDto> getNeirongChildren(String parentNo) {
		QueryWrapper<CmsNeirong> queryWrapper = new QueryWrapper<CmsNeirong>();
		queryWrapper.likeRight("mbh",parentNo + "%");
		queryWrapper.orderByAsc("mbh");
		List<CmsNeirong> list = cmsNeirongMapper.selectList(queryWrapper);
		list.remove(0);
		return WoKit.getDtos(CmsNeirongDto.class, list);
	}
}
